package  com.openrange.dukes
{
	import org.flixel.*;
	
	public class Tile extends FlxSprite
	{
		
		
		//positions of the specific tiles within the terrain_tiles asset
		static public var GRASS:int = 1;
		static public var FOREST:int = 2;
		static public var WATER:int = 0;
		static public var DESERT:int = 3;
		static public var MOUNTAIN:int = 4;
		
		
		//Record tile type
		private var _terrainType:int;
		
		public function Tile(X:Number, Y:Number, width:int, height:int, stamp:FlxSprite, terrainType:int) 
		{
			super(X, Y, null);
			makeGraphic(width, height);
			setTileType(stamp, terrainType);
		}
		
		public function setTileType(stamp:FlxSprite, type:int):void
		{
			this.stamp(stamp, -this.width * type, 0);
			_terrainType = type;
		}
		public function getTileType():int
		{
			return _terrainType;
		}
		
		static public function getTileNameText(type:int):String
		{
			if (type == GRASS) return "Grass";
			else if (type == FOREST) return "Forest";
			else if (type == WATER) return "Water";
			else if (type == DESERT) return "Desert";
			else if (type == MOUNTAIN) return "Mountain";
			return "Floating on bugs ;)";
		}
		
		static public function getTileEffectText(type:int):String
		{
			if (type == GRASS) return "Grass effect";
			else if (type == FOREST) return "Forest effect";
			else if (type == WATER) return "Water effect";
			else if (type == DESERT) return "Desert effect";
			else if (type == MOUNTAIN) return "Mountain effect";
			return "Cockroach Strength";
			
		}
		
		
		
	}

}